<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Product_Partner extends MY_Controller {

    var $_templates = array();
    var $_lang = '';

    function __construct() {
        parent::__construct();
        $this->session->set_userdata(array('Url' => uri_string()));
        $this->_lang = $this->lang->lang();
        $this->load->model('product_model', 'products');
        $this->load->helper('product_category_menu');
        $this->load->model('banners_model', 'banners');
        $this->load->model('partner_model', 'partner');
        $this->load->library('string_library');
    }

    public function index($alias = "") {
        $data = array();
        // request alias và lay danh muc dua vao alias
        $str_alias = $this->uri->uri_string();
        $arr_alias = explode('/page/', $str_alias);
        $str_alias_curr = 0;
        if (count($arr_alias) > 1) {
            $start = end($arr_alias);
            $name_alias = $arr_alias[0];
        } else if (count($arr_alias) == 1) {
            $start = 0;
            $name_alias = end(explode("/", $arr_alias[0]));
        } else {
            $name_alias = $str_alias;
            $start = 0;
        }
        $name_alias = str_replace('.html', '', $name_alias);
        $data['start'] = $start;
        $data['itemPartner'] = $this->partner->getPartnersFromId($name_alias);
        $data['base_url'] = base_url() . 'thuong-hieu/'.$data['itemPartner']->name_alias."/page/";
        $data['num'] = $this->products->getNumProductFromPartnerAlias($name_alias);
        $data['uri_segment'] = $this->uri->total_segments();
        $data['per_page'] = 33;
        $this->pagination->initialize(getPaginationConfig($data));
        $data['pagination'] = $this->pagination->create_links();
        $data['listproductItems'] = $this->products->getProductFromPartnerAlias($name_alias);
        $data['pageTitle'] = "ngoinhabeyeu.com - Mua sắm online quần áo, giày dép, phụ kiện, mỹ phẩm, bộ sưu tập công sở, thời trang trẻ";
        $this->_templates['page'] = 'product_partner/index_view';
        $this->site_lib->load($this->_templates['page'], $data);
    }

}

/* End of file product_category.php */
/* Location: ./application/controllers/product_category.php */